﻿using EnvCheck.Models;
using EnvCheck.View.Existing;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EnvCheck.View
{
    public static class GlobalViewModel
    {
        public static readonly ObservableCollection<BaseViewModel> AppVersionViewModel = [];
        public static readonly Dictionary<string, Dictionary<string,AppReqSatisfactionStatus>> ModelByReqVersion = [];
    }

    public abstract class BaseViewModel: EnvCheck.Utils.IAsyncInstalledAppReceiver,EnvCheck.Utils.IProgressReceiver, INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        protected void OnPropertyChanged(string propertyName)
            => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));

        public Dictionary<string, VersionMatchPolicy> VersionPolicyNames
            => AppVersionRequirement.VersionPolicyEnumsDisplays;

        public string VersionName { get; set; } = "导入";
        public abstract void Receive(string appName, string version);
        public abstract void ReportProgress(int current, int total);
    }
}
